#!/bin/bash
set -e # fail on errors

# Redirect stderr -> stdout
exec 2>&1

cd <%= node['registry']['dir'] %>

exec chpst -e <%= node['registry']['env_directory'] %> -P \
  -U <%= node['registry']['username'] %>:<%= node['registry']['group'] %> \
  -u <%= node['registry']['username'] %>:<%= node['registry']['group'] %> \
  /opt/gitlab/embedded/bin/registry serve ./config.yml
